//
//  CZStatusBottom.swift
//  weibo27
//
//  Created by mac on 16/4/19.
//  Copyright © 2016年 it.cast. All rights reserved.
//

import UIKit

// MARK: 底部视图
class CZStatusBottom: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
        
//        backgroundColor = UIColor.redColor()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: 懒加载底部视图的控件
    //转发
    private lazy var retweetedButton:UIButton = UIButton(title: " 转发", fontSize: 12, color: UIColor.darkGrayColor(), imageName: "timeline_icon_retweet")
    //评论
    private lazy var commenButton:UIButton = UIButton(title: " 评论", fontSize: 12, color: UIColor.darkGrayColor(), imageName: "timeline_icon_comment")
    //赞
    private lazy var linkButton:UIButton = UIButton(title: " 赞", fontSize: 12, color: UIColor.darkGrayColor(), imageName: "timeline_icon_unlike")
    
   
    
    
}


extension CZStatusBottom{
    
    private func setupUI(){
        
        //设置底部视图的三个按钮
        addSubview(retweetedButton)
        addSubview(commenButton)
        addSubview(linkButton)
        
        //设置他们的frame
        retweetedButton.snp_makeConstraints { (make) -> Void in
            
            make.left.equalTo(self.snp_left)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
        }
        
        commenButton.snp_makeConstraints { (make) -> Void in
            
            make.left.equalTo(retweetedButton.snp_right)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.width.equalTo(retweetedButton.snp_width)
        }
        
        linkButton.snp_makeConstraints { (make) -> Void in
            
            make.left.equalTo(commenButton.snp_right)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.right.equalTo(self.snp_right)
            make.width.equalTo(retweetedButton.snp_width)
        }
        
        // MARK: 添加分割线
        let line1 = setView()
        let line2 = setView()
        
        //添加
        addSubview(line1)
        addSubview(line2)
        
        let width = 1
        let scale = 0.4
        
        //设置frame
        line1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedButton.snp_right)
            make.width.equalTo(width)
            make.centerY.equalTo(retweetedButton.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
        }
        
        line2.snp_makeConstraints { (make) -> Void in
            make.right.equalTo(linkButton.snp_left)
            make.width.equalTo(width)
            make.centerY.equalTo(retweetedButton.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
        }
        
    }
    
    private func setView()->UIView{
        
        let vc = UIView()
        vc.backgroundColor = UIColor.darkGrayColor()
        return vc
    }
    
}










